from typing import *
from math import inf


class Solution:
    def getLargestOutlier(self, nums: List[int]) -> int:
        sm = sum(nums)
        ans = -inf
        cnt = Counter(nums)
        for v in nums:
            a = sm - v
            cnt[v] -= 1
            if a & 1 == 0 and cnt[a // 2] > 0:
                ans = max(ans, v)
            cnt[v] += 1
        return ans
